home *** CD-ROM | disk | FTP | other *** search
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %% header for the \special command
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % The structure of the PostScript produced by dvips for \special is:
- % @beginspecial
- % - any number of @hsize, @hoffset, @hscale, etc., commands
- % @setspecial
- % - the user's file of PostScript commands
- % @endspecial
-
- TeXDict begin
- /SDict 200 dict def
- SDict begin
-
- /@SpecialDefaults
- { /hs 612 def
- /vs 792 def
- /ho 0 def
- /vo 0 def
- /hsc 1 def
- /vsc 1 def
- /ang 0 def
- /CLIP false def
- /BBcalc false def
- } bdf
-
- %
- % The following definition sets up the units that hscale/vscale are in.
- % For certain sites this might require change, but it is
- % recommended instead that any macro packages that require
- % hscale/vscale set the units appropriately via
- %
- % \special{! /@scaleunit 1 def }
- %
- % if global, or
- %
- % \special{" /@scaleunit 1 def }
- %
- % before each instance if multiple macro packages with
- % different requirements are being used.
- %
- /@scaleunit 100 def
- % s @hscale - set scale factor
- /@hscale {@scaleunit div /hsc exch def} bdf
- /@vscale {@scaleunit div /vsc exch def} bdf
-
- % d @hsize - specify a horizontal clipping dimension
- /@hsize {/hs exch def /CLIP true def} bdf
- /@vsize {/vs exch def /CLIP true def} bdf
-
- % d @hoffset - specify a shift for the figure
- /@hoffset {/ho exch def} bdf
- /@voffset {/vo exch def} bdf
-
- % a @angle - set rotation angle
- /@angle {/ang exch def} bdf
-
- %
- % Here we handle bounding box calculations, if necessary.
- %
- /@rwi { 10 div /rwi exch def } bdf % rwi will be real width after scaling
- /@llx { /llx exch def } bdf
- /@lly { /lly exch def } bdf
- /@urx { /urx exch def } bdf
- /@ury { /ury exch def /BBcalc true def } bdf
-
- end % of SDict
-
- /@MacSetUp
- { userdict /md known % if md is defined
- { userdict /md get type /dicttype eq % and if it is a dictionary
- {
- md begin % then redefine some stuff
- /letter {} def
- /note {} def
- /legal {} def
- /od{txpose
- 1 0 mtx defaultmatrix dtransform exch atan/pa exch def
- newpath clippath mark
- {transform{itransform moveto}}
- {transform{itransform lineto}}
- { 6 -2 roll transform
- 6 -2 roll transform
- 6 -2 roll transform
- { itransform 6 2 roll
- itransform 6 2 roll
- itransform 6 2 roll
- curveto
- }
- }
- {{closepath}}
- pathforall newpath counttomark array astore /gc xdf
- pop ct 39 0 put
- 10 fz 0 fs 2 F/|______Courier fnt invertflag{PaintBlack}if
- }def
- /txpose{
- pxs pys scale ppr aload pop
- por {
- noflips {
- pop exch neg exch translate pop 1 -1 scale
- }if
- xflip yflip and {
- pop exch neg exch translate 180 rotate 1 -1 scale
- ppr 3 get ppr 1 get neg sub neg ppr 2 get
- ppr 0 get neg sub neg translate
- }if
- xflip yflip not and {
- pop exch neg exch translate pop 180 rotate
- ppr 3 get ppr 1 get neg sub neg 0 translate
- }if
- yflip xflip not and {
- ppr 1 get neg ppr 0 get neg translate
- }if
- }
- {
- noflips {
- translate pop pop 270 rotate 1 -1 scale
- }if
- xflip yflip and {
- translate pop pop 90 rotate 1 -1 scale
- ppr 3 get ppr 1 get neg sub neg ppr 2 get
- ppr 0 get neg sub neg translate
- }if
- xflip yflip not and {
- translate pop pop 90 rotate ppr 3 get
- ppr 1 get neg sub neg 0 translate
- }if
- yflip xflip not and {
- translate pop pop 270 rotate ppr 2 get
- ppr 0 get neg sub neg 0 exch translate
- }if
- }ifelse
- scaleby96 {
- ppr aload pop 4 -1 roll add 2 div 3 1 roll add 2 div 2 copy
- translate .96 dup scale neg exch neg exch translate
- }if
- }def
- /cp {pop pop showpage pm restore}def
- end
- }if
- } if
- } def
-
- %
- % We need the psfig macros.
- %
- % All software, documentation, and related files in this distribution of
- % psfig/tex are Copyright (c) 1987 Trevor J. Darrell
- %
- % Permission is granted for use and non-profit distribution of psfig/tex
- % providing that this notice be clearly maintained, but the right to
- % distribute any portion of psfig/tex for profit or as part of any commercial
- % product is specifically reserved for the author.
- %
- %
- % psfigTeX PostScript Prolog
- % $Header: /sprite/src/cmds/dvips/RCS/special.lpro,v 1.1 90/02/27 10:59:28 douglis Exp $
- %
- /psf$TeXscale { 65536 div } def
-
- % x y bb-llx bb-lly bb-urx bb-ury startFig -
- /startTexFig {
- /psf$SavedState save def
- userdict maxlength dict begin
-
- Resolution 72 div dup neg scale
- currentpoint translate %set the current point as the user's origin
-
- /psf$ury exch psf$TeXscale def
- /psf$urx exch psf$TeXscale def
- /psf$lly exch psf$TeXscale def
- /psf$llx exch psf$TeXscale def
- /psf$y exch psf$TeXscale def
- /psf$x exch psf$TeXscale def
-
- currentpoint /psf$cy exch def /psf$cx exch def
-
- /psf$sx psf$x psf$urx psf$llx sub div def % scaling for x
- /psf$sy psf$y psf$ury psf$lly sub div def % scaling for y
-
- psf$sx psf$sy scale % scale by (sx,sy)
-
- psf$cx psf$sx div psf$llx sub
- psf$cy psf$sy div psf$ury sub translate
-
- /showpage {
- } def
- /erasepage {
- } def
- /copypage {
- } def
- @MacSetUp
- } def
-
- % llx lly urx ury doclip - (args in figure coordinates)
- /doclip {
- psf$llx psf$lly psf$urx psf$ury
- currentpoint 6 2 roll
- newpath 4 copy
- 4 2 roll moveto
- 6 -1 roll exch lineto
- exch lineto
- exch lineto
- closepath clip
- newpath
- moveto
- } def
- % - endTexFig -
- /endTexFig { end psf$SavedState restore } def
-
- % this will be invoked as the result of a \special command (for the
- % inclusion of PostScript graphics). The basic idea is to change all
- % scaling and graphics back to defaults, but to shift the origin
- % to the current position on the page.
-
- /@beginspecial % - @beginspecial - -- enter special mode
- { SDict begin
- /SpecialSave save def
- gsave
- Resolution 72 div dup neg scale
- currentpoint translate %set the current point as the user's origin
- @SpecialDefaults % setup default offsets, scales, sizes, and angle
- } bdf
-
- /@setspecial % to setup user specified offsets, scales, sizes (for clipping)
- {
- CLIP
- { newpath 0 0 moveto hs 0 rlineto 0 vs rlineto hs neg 0 rlineto
- closepath clip }
- { initclip }
- ifelse
- ho vo translate
- hsc vsc scale
- ang rotate
- BBcalc
- { rwi urx llx sub div dup scale
- llx neg lly neg translate }
- if
- /showpage {} def
- newpath
- } bdf
-
- /@endspecial % - @endspecial - -- leave special mode
- { grestore clear SpecialSave restore
- end
- } bdf
- /@defspecial
- {
- SDict begin
- } bdf
- /@fedspecial
- {
- end
- } bdf
-
- %%% macros for tpic
- /li % x y li - -- draw line to
- { lineto
- } bdf
-
- /rl % dx dy rl - -- draw relative line
- { rlineto
- } bdf
-
- /rc % x0 y0 x1 y1 y2 y2 rc -- draw bezier curve
- { rcurveto
- } bdf
-
- /np % np - -- start a new path and save currenpoint
- { /SaveX currentpoint /SaveY exch def def % remember current point
- newpath
- } bdf
-
- /st % st - -- draw the last path and restore currentpoint
- { stroke
- SaveX SaveY moveto % restore the current point
- } bdf
-
- /fil % fil -- fill the last path and restore currentpoint
- { fill
- SaveX SaveY moveto % restore the current point
- } bdf
-
- /ellipse % xc yc xrad yrad startAngle endAngle ellipse
- {
- /endangle exch def
- /startangle exch def
- /yrad exch def
- /xrad exch def
-
- /savematrix matrix currentmatrix def
-
- translate
- xrad yrad scale
- 0 0 1 startangle endangle arc
- savematrix setmatrix
- } bdf
- %%% end of macros for tpic
- end % revert to previous dictionary
-